package edu.pku.sei.transformation.util.metamodelloader;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.EMOFResourceFactoryImpl;

import edu.pku.sei.modeler.model.core.MetaModel;

public class EMOFMetaModelLoader extends EcoreMetaModelLoader {
	public EMOFMetaModelLoader(String fileAddress, MetaModel projectModel) {
		super(fileAddress, projectModel);
	}

	@Override
	protected void loadEcoreFile() {
		ResourceSet resourceSet = new ResourceSetImpl();
		resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
				.put(Resource.Factory.Registry.DEFAULT_EXTENSION,
						new EMOFResourceFactoryImpl());
		URI fileURI = URI.createFileURI(xmiFile.getAbsolutePath());
		this.resource = resourceSet.getResource(fileURI, true);
	}

}
